﻿var FCKNowDate = function(name){
    this.Name = name;
}
FCKNowDate.prototype.Execute = function(){
    FCK.InsertHtml(getdate());
}
FCKNowDate.prototype.GetState = function(){
    return FCK_TRISTATE_OFF;
}
FCKCommands.RegisterCommand('NowDate', new FCKNowDate('NowDate'));
var oNowDateItem = new FCKToolbarButton('NowDate', 'NowDate', null, null, false, true);
oNowDateItem.IconPath = FCKConfig.PluginsPath + 'datetime/date.gif';
FCKToolbarItems.RegisterItem('NowDate', oNowDateItem);

function getdate(){
    var date = new Date();
    var year = date.getFullYear().toString(10);
    var month = (date.getMonth() + 1).toString(10);
    month = month.length < 2 ? '0' + month : month;
    var day = date.getDate().toString(10);
    day = day.length < 2 ? '0' + day : day;
    var value = year + '-' + month + '-' + day;
    return value
}

